package com.example.demo.service.impl;


import com.example.demo.entiy.Comment;
import com.example.demo.mapper.CommentMapper;
import com.example.demo.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    CommentMapper commentMapper;


    @Override
    public List<Comment> getCommentListByArticleId(Integer articleId) {
        return commentMapper.getCommentListByArticleId(articleId);
    }

    @Override
    public int insertCommentByComment(Comment comment) {
        return commentMapper.insertCommentByComment(comment);
    }

    @Override
    public int getAllCommentNum() {
        return commentMapper.getAllCommentNum();
    }

    @Override
    public List<Comment> getCommentOrderByCreatedDesc() {
        return commentMapper.getCommentOrderByCreatedDesc();
    }

    @Override
    public int deleteCommentByArticleId(Integer articleId) {
        return commentMapper.deleteCommentByArticleId(articleId);
    }
}
